from gui import Gui

class ChannelDialog(Gui):

    def __init__(self, channel, frequency):
        '''
        Class to display channel_dialog (to edit channel)
        '''
        Gui.__init__(self, 'channels', 'edit_dialog')
        self.channel = channel
        self.frequency = frequency
    
    def run(self):
        '''
        Function to show the dialog.
        get_widget channel_dialog, then run() it, get its response id, 
        entries from the dialog, then destroy the dialog
        '''        
        c = self.widget('name_entry')
        f = self.widget('freq_entry')
        c.set_text(self.channel)
        f.set_text(self.frequency)
        
        result = self.window.run()
        channel = c.get_text()
        frequency = f.get_text()
        self.window.destroy()
        
        return result, channel, frequency
